/**
 * This class provides the modal Ext.Window support for all Authentication forms.
 * It's layout is structured to center any Authentication dialog within it's center,
 * and provides a backGround image during such operations.
 */
Ext.define('Monkey.view.code.PropertiesWindow', {
    extend: 'Ext.window.Window',
    xtype: 'propertieswindow',

    requires: [],

    controller: 'ctrl-generator',
    closable: true,
    resizable: true,
    constrain: true,
    constrainHeader: true,
    modal: true,
    frameHeader: false,
    frame: true,
    maximizable: false,
    layout: 'fit',
    title: '添加属性',
    icon: 'resources/icons/16/table_add.png',
    width: 350,
    height: 200,
    initComponent: function () {
        var form = {
            xtype: 'form',
            border: false,
            buttonAlign: 'center',
            reference: 'form',
            layout: 'form',
            bodyStyle: 'padding:15px 5px 0 5px',
            defaults: {
                labelWidth: 80,
                labelAlign: 'right'
            },
            defaultType: 'textfield',
            buttons: [{
                formBind: true,
                text: '确定',
                iconCls: 'accept',
                handler: 'addProperty'
            }, {
                text: '取消',
                iconCls: 'delete',
                handler: 'cancelWindow'
            }]
        };


        form.items = [{
            itemId: 'name',
            allowBlank: false,
            fieldLabel: '<span style="color: red">*</span>名称'
        }, {
            itemId: 'type',
            allowBlank: false,
            xtype: 'combobox',
            fieldLabel: '<span style="color: red">*</span>类型',
            queryMode: 'local',
            displayField: 'name',
            valueField: 'value',
            store: Ext.create('Ext.data.Store', {
                fields: ['name', 'value'],
                data: [
                    {"name": "String", "value": "String"},
                    {"name": "Double", "value": "Double"},
                    {"name": "Integer", "value": "Integer"},
                    {"name": "Float", "value": "Float"},
                    {"name": "Long", "value": "Long"},
                    {"name": "BigDecimal", "value": "BigDecimal"},
                    {"name": "Date", "value": "Date"},
                    {"name": "Boolean", "value": "Boolean"}
                ]
            })
        }, {
            itemId: 'remark',
            allowBlank: false,
            fieldLabel: '<span style="color: red">*</span>备注'
        }];

        this.items = [form];
        this.callParent();
    }
});
